var alphaValue = 100;
var timer;
var listArr = new Array();
function openPopUp(popupName,bg){
	var popup = document.getElementById(popupName);
	popup.style.visibility='visible';
	if(bg!=null){
		var back = document.getElementById(bg);
		back.style.filter = 'alpha(opacity=\'30\')';
	}
	//timer = setInterval("changeBg('"+bg+"',"+(-1)+")", 100); 
}
function changeBg(objName,flag){
	alphaValue = alphaValue+flag*10;
	if(flag==(-1)){
		if(alphaValue>=30){
			var tour = document.getElementById(objName);
			if(tour.filters){
				tour.style.filter = 'alpha(opacity='+alphaValue+')';
			}
			else{
				tour.style.opacity = (alphaValue/100);
			}
		}
		else{
			clearInterval(timer);
			}
	}
	else{
		if(alphaValue<100){
			var tour = document.getElementById(objName);
			if(tour.filters){
				tour.style.filter = 'alpha(opacity='+alphaValue+')';
			}
			else{
				tour.style.opacity = (alphaValue/100);
			}
		}
		else{
			alphaValue=100;
			clearInterval(timer);
		}
	}
}
function closePopUp(popupName,bg){
	var popup = document.getElementById(popupName);
	popup.style.visibility='hidden';
	var choice_btn = document.getElementById('choice_btn');
	choice_btn.style.visibility='hidden';
	document.city_find.city.style.visibility='hidden';
	if(bg!=null){
		var back = document.getElementById(bg);
		back.style.filter = 'alpha(opacity=\'100\')';
	}
	//timer = setInterval("changeBg('"+bg+"',"+1+")", 100); 
}
function rollOver(objectBtn,objectWhere){
	var img = document.getElementById(objectBtn);
	if(objectWhere != null)	{
		img.src="images/menu/"+objectBtn+"_on.gif";
	}
	else{
		img.src="../images/menu/"+objectBtn+"_on.gif";
	}
}
function rollOut(objectBtn,objectWhere){
	var img = document.getElementById(objectBtn);
	if(objectWhere != null)	{
		img.src="images/menu/"+objectBtn+".gif";
	}
	else{
		img.src="../images/menu/"+objectBtn+".gif";
	}
}
function located(num,objId,targetId,contentId){
	var locate = document.getElementById(objId);
	var target = document.getElementById(targetId);
	var locate_contents = document.getElementById(contentId);
	var ulArr =document.getElementsByTagName('ul');
	var ul = ulArr[0];
	ul.style.listStyle = 'none';
	if(listArr[num]==null){
		target.innerHTML += locate.innerHTML;
	}
	else{
		locate_contents.style.visibility='visible';
	}
}
function disappear(objId,targetId){
	var locate = document.getElementById(objId);
	var target = document.getElementById(targetId);
	locate.style.visibility='hidden';
	if(listArr[0]==null){
		listArr[0]=false;
	}
}
function showList(listId){
	var list = document.getElementById(listId);
	list.style.visibility='visible';
}
function sendCities(endPoint,url){
	var iframe = document.search_result_list;
	iframe.location.href=url+"?endPoint="+endPoint;
}
function getYears(max){
	var nowDate = new Date();
	var thisYear = nowDate.getYear();
	for(var i=thisYear;i<=max;i++){
		document.search_city_form.departYear.add(new Option(i,i));
	}
}
function getDates(max){
	for(var i=1;i<=max;i++){
		document.search_city_form.departDate.add(new Option(i,i));
	}
}
function getMonths(max){
	for(var i=1;i<=max;i++){
		document.search_city_form.departMonth.add(new Option(i,i));
	}
}
